import 'package:flutter/material.dart';
import 'package:get_storage/get_storage.dart';

class StorageUtil {
  static final GetStorage _box = GetStorage();

  /// 写入数据（同步）
  static void write(String key, dynamic value) => _box.write(key, value);

  /// 读取数据
  static T? read<T>(String key) => _box.read<T>(key);

  /// 删除数据
  static void remove(String key) => _box.remove(key);

  /// 监听数据变化
  static VoidCallback listen(VoidCallback callback) => _box.listen(callback);
}
